package com.seal.action.busi;

import java.util.List;

import javax.annotation.Resource;

import com.seal.action.BaseAction;
import com.seal.dto.VerifybookDto;
import com.seal.model.Verifybook;
import com.seal.service.IVerifybookService;

public class ReportAction extends BaseAction{
	
	@Resource(name="verifybookServiceImpl")
	private IVerifybookService verifybookService;
	
	private VerifybookDto verifybookDto;
	
	public String verify() throws Exception{
		if ((null != pageObj) && (null != parameters.get("page"))) {
			String[] str = (String[]) parameters.get("page");
			pageObj.setCurrentPage(Integer.parseInt(str[0]));
		}
		VerifybookDto dto=new VerifybookDto();
		if(verifybookDto!=null){
			dto.setFromDate(verifybookDto.getFromDate());
			dto.setToDate(verifybookDto.getToDate());
			if(!"2".equals(verifybookDto.getVflag())){
				dto.setVflag(verifybookDto.getVflag());
			}
		}
		dto.setCompanyId(this.getCompanyId());
		
		List<Verifybook> bookList = verifybookService.getVerifybookList(dto, pageObj);
		pageObj.allowPage(request, "report_verify");
		this.setRequestAttr("list", bookList);
		this.showActionMsg();
		return "verifybook";
	}
	
	public String vhist() throws Exception{
		if ((null != pageObj) && (null != parameters.get("page"))) {
			String[] str = (String[]) parameters.get("page");
			pageObj.setCurrentPage(Integer.parseInt(str[0]));
		}
		VerifybookDto dto=new VerifybookDto();
		if(verifybookDto!=null){
			dto.setFromDate(verifybookDto.getFromDate());
			dto.setToDate(verifybookDto.getToDate());
		}
		dto.setVerifyUserid(this.getUserId());
		
		List<Verifybook> bookList = verifybookService.getVerifybookList(dto, pageObj);
		pageObj.allowPage(request, "report_vhist");
		this.setRequestAttr("list", bookList);
		this.showActionMsg();
		return "verifyhist";
	}
	
	public VerifybookDto getVerifybookDto() {
		return verifybookDto;
	}

	public void setVerifybookDto(VerifybookDto verifybookDto) {
		this.verifybookDto = verifybookDto;
	}
	
}
